package edu.towson.cosc.cosc455.jirani2.compiler;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.TreeMap;
/*
 * Holds all Lexical tokens for .lol and .html
 */

public class LexicalTokens {
	/** ArrayList with Lexical Tokens */
	public static ArrayList<String> lexTokens = new ArrayList<String>();
	/** ArrayList that holds all text tokens */
	public static ArrayList<String> textDictionary = new ArrayList<String>();
	/** list to determine if end tag */
	public static List<String> endTags = Arrays.asList("#KTHXBYE",
			"#OIC", "#TLDR", "#MKAY");
	/** list to determine only beginning tags */
	final static List<String> begTags = Arrays.asList("#HAI", "#MAEK HEAD", 
			"#GIMMEH TITLE","#OBTW","#MAEK PARAGRAF","#GIMMEH BOLD","#GIMMEH ITLAICS","#MAEK LIST",
			"#GIMMEH ITEM","#GIMMEH NEWLINE","#GIMMEH SOUNDZ","#GIMMEH VIDZ");
	/** map that determines beg html to end html */
	public static TreeMap<String,String> bteHtml = new TreeMap<String,String>();
	/** map that determines beg html, given beg lol code */
	public static TreeMap<String,String> lolToHtml = new TreeMap<String,String>();
	/** map that holds beginning html tags */
	public static List<String> beginHtmlTags = 
			Arrays.asList("<html>","<!--","<head>", "<title>",
					"<p>","<b>","<i>","<ul>","<li>",
					"<audio controls><source src=\"","<iframe src=\"");
	
	
	final static String DOC_BEGIN = "#HAI";
	final static String DOC_END = "#KTHXBYE";
	final static String HEAD_BEGIN = "#MAEK HEAD";
	final static String HEAD_END = "#OIC";
	final static String COMMENT_BEGIN = "#OBTW";
	final static String COMMENT_END = "#TLDR";
	final static String TITLE_BEGIN = "#GIMMEH TITLE";
	final static String TITLE_END = "#MKAY";
	final static String PARA_BEGIN = "#MAEK PARAGRAF";
	final static String PARA_END = "#OIC";
	final static String BOLD_BEGIN = "#GIMMEH BOLD";
	final static String BOLD_END = "#MKAY";
	final static String ITALICS_BEGIN = "#GIMMEH ITALICS";
	final static String ITALICS_END = "#MKAY";
	final static String LIST_BEGIN = "#MAEK LIST";
	final static String LIST_END = "#OIC";
	final static String ITEM_BEGIN = "#GIMMEH ITEM";
	final static String ITEM_END = "#MKAY";
	final static String NEWLINE = "#GIMMEH NEWLINE";
	final static String SOUND_BEGIN = "#GIMMEH SOUNDZ";
	final static String SOUND_END = "#MKAY";
	final static String VIDEO_BEGIN = "#GIMMEH VIDZ";
	final static String VIDEO_END = "#MKAY";
	final static String VAR_BEGIN = "#I HAS A";
	final static String VAR_MIDDLE = "#ITZ";
	final static String VAR_END = "#MKAY";
	final static String VAR_USE = "#VISIBLE";
	final static String VAR_USE_END = "#MKAY";
	
	final static String HTML_DOC_BEGIN = "<html>";
	final static String HTML_DOC_END = "</html>";
	final static String HTML_COMMENT_BEGIN = "<!--";
	final static String HTML_COMMENT_END = "-->";
	final static String HTML_HEAD_BEGIN = "<head>";
	final static String HTML_HEAD_END = "</head>";
	final static String HTML_TITLE_BEGIN = "<title>";
	final static String HTML_TITLE_END = "</title>";
	final static String HTML_PARA_BEGIN = "<p>";
	final static String HTML_PARA_END = "</p>";
	final static String HTML_BOLD_BEGIN = "<b>";
	final static String HTML_BOLD_END = "</b>";
	final static String HTML_ITALICS_BEGIN = "<i>";
	final static String HTML_ITALICS_END = "</i>";
	final static String HTML_LIST_BEGIN = "<ul>";
	final static String HTML_LIST_END = "</ul>";
	final static String HTML_ITEM_BEGIN = "<li>";
	final static String HTML_ITEM_END = "</li>";
	final static String HTML_NEWLINE = "<br>";
	final static String HTML_SOUNDS_BEGIN = "<audio controls><source src=\"";
	final static String HTML_SOUNDS_END = "\"></audio>";
	final static String HTML_VIDEO_BEGIN = "<iframe src=\"";
	final static String HTML_VIDEO_END = "\"/>";
	
	/** method initalizes hte maps to convert lol code, as well
	 * as pushes all valid tokens onto arraylist for processing.
	 */
	public void addTokens(){
		bteHtml.put(HTML_DOC_BEGIN, HTML_DOC_END );
		bteHtml.put(HTML_COMMENT_BEGIN, HTML_COMMENT_END );
		bteHtml.put(HTML_HEAD_BEGIN, HTML_HEAD_END );
		bteHtml.put(HTML_TITLE_BEGIN, HTML_TITLE_END );
		bteHtml.put(HTML_PARA_BEGIN, HTML_PARA_END);
		bteHtml.put(HTML_BOLD_BEGIN, HTML_BOLD_END );
		bteHtml.put(HTML_ITALICS_BEGIN, HTML_ITALICS_END );
		bteHtml.put(HTML_LIST_BEGIN, HTML_LIST_END );
		bteHtml.put(HTML_ITEM_BEGIN, HTML_ITEM_END );
		bteHtml.put(HTML_SOUNDS_BEGIN, HTML_SOUNDS_END );
		bteHtml.put(HTML_VIDEO_BEGIN, HTML_VIDEO_END );
		
		lolToHtml.put(DOC_BEGIN, HTML_DOC_BEGIN);
		lolToHtml.put(COMMENT_BEGIN, HTML_COMMENT_BEGIN);
		lolToHtml.put(HEAD_BEGIN, HTML_HEAD_BEGIN);
		lolToHtml.put(TITLE_BEGIN, HTML_TITLE_BEGIN);
		lolToHtml.put(PARA_BEGIN, HTML_PARA_BEGIN);
		lolToHtml.put(BOLD_BEGIN, HTML_BOLD_BEGIN);
		lolToHtml.put(ITALICS_BEGIN, HTML_ITALICS_BEGIN);
		lolToHtml.put(LIST_BEGIN, HTML_LIST_BEGIN);
		lolToHtml.put(ITEM_BEGIN, HTML_ITEM_BEGIN);
		lolToHtml.put(NEWLINE, HTML_NEWLINE);
		lolToHtml.put(SOUND_BEGIN, HTML_SOUNDS_BEGIN);
		lolToHtml.put(VIDEO_BEGIN, HTML_VIDEO_BEGIN);
		
		
		lexTokens.add(DOC_BEGIN);
		lexTokens.add(DOC_END);
		lexTokens.add(HEAD_BEGIN);
		lexTokens.add(HEAD_END);
		lexTokens.add(COMMENT_BEGIN);
		lexTokens.add(COMMENT_END);
		lexTokens.add(TITLE_BEGIN);
		lexTokens.add(TITLE_END);
		lexTokens.add(PARA_BEGIN);
		lexTokens.add(PARA_END);
		lexTokens.add(BOLD_BEGIN);
		lexTokens.add(BOLD_END);
		lexTokens.add(ITALICS_BEGIN);
		lexTokens.add(ITALICS_END);
		lexTokens.add(LIST_BEGIN);
		lexTokens.add(LIST_END);
		lexTokens.add(ITEM_BEGIN);
		lexTokens.add(ITEM_END);
		lexTokens.add(SOUND_BEGIN);
		lexTokens.add(SOUND_END);
		lexTokens.add(VIDEO_BEGIN);
		lexTokens.add(VIDEO_END);
		lexTokens.add(VAR_BEGIN);
		lexTokens.add(VAR_MIDDLE);
		lexTokens.add(VAR_END);
		lexTokens.add(VAR_USE);
		lexTokens.add(VAR_USE_END);
		lexTokens.add(NEWLINE);
	}
}
